7.1 Introduction to JavaScript

  1. Motivations
    • Try n-Puzzle Game.
    • You have learned HTML and CSS. What else do you need to write the code for the above game?

  2. HTML and CSS are
    • They are mostly descriptive languages.
    • There are only a few limited ways to respond to user actions. Do you rememeber :hover, :active, :target, and :checked pseudo classes?
    • How to react to the selection of numbers, and clicking on buttons in n-puzzle game? How to read user inputs and use them?
  3. What you need is
    • You need a programming language.
    • JavaScript
      • You can do the followings.
      • Read user inputs.
      • React to user activities, such as mouse move, click, keyboard, ...
      • Control HTML elements
      • ...
  4. Read all in JavaScript Introduction.
    • What can you do with JavaScript?
      • Reacting to events, such as mouse clicking
      • Contents
      • Attributes
      • Styles, i.e., CSS properties
  5. The topics in JavaScript are beyond of this course. If you are interested in JavaScript, you can continue studying with the next sections - 7.2, ..., at least 7.2.2.
  6. Lab 8.

  7. Learning outcomes